<?php 
session_start();include "conn.php";
?>
<?php  include("admin.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control.css" rel="stylesheet" type="text/css" />
</head>

<body>
<a name="top" id="top"></a>
<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
<div id="top-1"><?php include_once('blog_top_btn.php');?>
</div>
<!--Content for  id "submenu" Goes Here //-->
<div id="submenu">
<?php include_once('tagcloud_main_btn.php');?>
  </div>
 <!--Content for  id "contact" Goes Here //-->
 
 
 
 
 
 
 
  <script language="javascript">
function check(form){
if (form1.title.value=="")
{alert("請填寫 標題！");form1.title.focus();return false;}
}
</script>




<?php
//文件名。。。
$webname="tagcloud"; 
$linkname="tagcloud-main"; 
?>

<?php 
$id=make_safe($_GET["id"]);

//echo $data;
$action=make_safe($_GET["action"]);
$BigClassName=make_safe($_POST["BigClassName"]);
$BigClassName2=make_safe($_POST["BigClassName2"]);
$BigClassName3=make_safe($_POST["BigClassName3"]);
$BigClassName4=make_safe($_POST["BigClassName4"]);
$BigClassName5=make_safe($_POST["BigClassName5"]);
$BigClassName6=make_safe($_POST["BigClassName6"]);

$enBigClassName=make_safe($_POST["enBigClassName"]);
$SmallClassName=make_safe($_POST["SmallClassName"]);
$enSmallClassName=make_safe($_POST["enSmallClassName"]);
$title=make_safe($_POST["title"]);
$entitle=make_safe($_POST["entitle"]);
//$addtime=make_safe($_POST["addtime"]);
$lb=make_safe($_POST["lb"]);
$addtime=$data2;
$addtime2=$data3;
$edittime=$data2;
$editname=$_SESSION["username2"];
$user=make_safe($_POST["user"]);
$content=$_POST["content"];
$encontent=$_POST["encontent"];
$c1=make_safe($_POST["c1"]);
if($c1==""){$c1=0;}
$c2=make_safe($_POST["c2"]);
if($c2==""){$c2=0;}
$c3=make_safe($_POST["c3"]);
if($c3==""){$c3=0;}
$c4=make_safe($_POST["c4"]);
if($c4==""){$c4=0;}
$c5=make_safe($_POST["c5"]);
if($c5==""){$c5=0;}
$c6=make_safe($_POST["c6"]);
if($c6==""){$c6=0;}
$c7=make_safe($_POST["c7"]);
if($c7==""){$c7=0;}
$c8=make_safe($_POST["c8"]);
if($c8==""){$c8=0;}
$c9=make_safe($_POST["c9"]);
if($c9==""){$c9=0;}




$oldimages=make_safe($_POST["oldimages"]);
$oldimages2=make_safe($_POST["oldimages2"]);
$oldimages3=make_safe($_POST["oldimages3"]);
$oldimages4=make_safe($_POST["oldimages4"]);
$oldimages5=make_safe($_POST["oldimages5"]);
$oldimages6=make_safe($_POST["oldimages6"]);
$oldimages7=make_safe($_POST["oldimages7"]);
$oldimages8=make_safe($_POST["oldimages8"]);


include("check.php");




$path = 'upfiles/'. $_FILES['images']['name'];
$type=strstr($path,'.');
$path2 ='upfiles/'.$data."-1".$type;

$path3 = 'upfiles/'. $_FILES['images2']['name'];
$type3=strstr($path3,'.');
$path4 ='upfiles/'.$data."-2".$type3;

$path5 = 'upfiles/'. $_FILES['images3']['name'];
$type5=strstr($path5,'.');
$path6 ='upfiles/'.$data."-3".$type5;

$path7 = 'upfiles/'. $_FILES['images4']['name'];
$type7=strstr($path7,'.');
$path8 ='upfiles/'.$data."-4".$type7;

$path9 = 'upfiles/'. $_FILES['images5']['name'];
$type9=strstr($path9,'.');
$path10 ='upfiles/'.$data."-5".$type9;

$path11 = 'upfiles/'. $_FILES['images6']['name'];
$type11=strstr($path11,'.');
$path12 ='upfiles/'.$data."-6".$type11;

$path13 = 'upfiles/'. $_FILES['images7']['name'];
$type13=strstr($path13,'.');
$path14 ='upfiles/'.$data."-7".$type13;

$path15 = 'upfiles/'. $_FILES['images8']['name'];
$type15=strstr($path15,'.');
$path16 ='upfiles/'.$data."-8".$type15;



$type=strtolower($type); 
$type3=strtolower($type3); 
$type5=strtolower($type5); 
$type7=strtolower($type7); 
$type9=strtolower($type9); 
$type11=strtolower($type11); 
$type13=strtolower($type13);
$type15=strtolower($type15);


 


//修改数据
if($action=="xiugai"){

if($type==".jpg"  or $type==".jpge" or $type==".gif" or $type==".doc" or $type==".xls" or $type==".bmp" or $type==".pdf" ){
move_uploaded_file($_FILES['images']['tmp_name'],$path2);//上传图片

$aa=getimagesize($path2);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path2);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path2);
    $t->createImg(115,115);


$aa=getimagesize($path2);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path2, $weight1, $height1, "0","big/".$path2);
if($path2 !='upfiles/'.$data."-1"){unlink($path2);}
if($oldimages!=""){unlink("pic/".$oldimages);unlink("big/".$oldimages);}//删除旧图片

}
else
{
$path2=$oldimages;
}

if($type3==".jpg"  or $type3==".jpge" or $type3==".gif" or $type3==".doc" or $type3==".xls" or $type3==".bmp" or $type3==".pdf" ){
move_uploaded_file($_FILES['images2']['tmp_name'],$path4);//上传图片

$aa=getimagesize($path4);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path4);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path4);
    $t->createImg(115,115);


$aa=getimagesize($path4);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path4, $weight1, $height1, "0","big/".$path4);
if($path4!='upfiles/'.$data."-2"){unlink($path4);}
if($oldimages2!=""){unlink($oldimages2);unlink("pic/".$oldimages2);unlink("big/".$oldimages2);}//删除旧图片

}
else
{
$path4=$oldimages2;
}
 
if($type5==".jpg"  or $type5==".jpge" or $type5==".gif" or $type5==".doc" or $type5==".xls" or $type5==".bmp" or $type5==".pdf" ){
move_uploaded_file($_FILES['images3']['tmp_name'],$path6);//上传图片

$aa=getimagesize($path6);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path6);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path6);
    $t->createImg(115,115);


$aa=getimagesize($path6);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path6, $weight1, $height1, "0","big/".$path6);
if($path6 !='upfiles/'.$data."-3"){unlink($path6);}
if($oldimages3!=""){unlink($oldimages3);unlink("pic/".$oldimages3);unlink("big/".$oldimages3);}//删除旧图片

}
else
{
$path6=$oldimages3;
}

if($type7==".jpg"  or $type7==".jpge" or $type7==".gif" or $type7==".doc" or $type7==".xls" or $type7==".bmp" or $type7==".pdf" ){
move_uploaded_file($_FILES['images4']['tmp_name'],$path8);//上传图片

$aa=getimagesize($path8);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高

if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path8);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path8);
    $t->createImg(115,115);


$aa=getimagesize($path8);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path8, $weight1, $height1, "0","big/".$path8);
if($path8 !='upfiles/'.$data."-4"){unlink($path8);}
if($oldimages4!=""){unlink($oldimages4);unlink("pic/".$oldimages4);unlink("big/".$oldimages4);}//删除旧图片

}
else
{
$path8=$oldimages4;
}

if($type9==".jpg"  or $type9==".jpge" or $type9==".gif" or $type9==".doc" or $type9==".xls" or $type9==".bmp" or $type9==".pdf" ){
move_uploaded_file($_FILES['images5']['tmp_name'],$path10);//上传图片


$aa=getimagesize($path10);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path10);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path10);
    $t->createImg(115,115);



$aa=getimagesize($path10);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path10, $weight1, $height1, "0","big/".$path10);
if($path10 !='upfiles/'.$data."-5"){unlink($path10);}
if($oldimages5!=""){unlink($oldimages5);unlink("pic/".$oldimages5);unlink("big/".$oldimages5);}//删除旧图片

}
else
{
$path10=$oldimages5;
}

if($type11==".jpg"  or $type11==".jpge" or $type11==".gif" or $type11==".doc" or $type11==".xls" or $type11==".bmp" or $type11==".pdf" ){
move_uploaded_file($_FILES['images6']['tmp_name'],$path12);//上传图片

$aa=getimagesize($path12);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path12);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path12);
    $t->createImg(115,115);


$aa=getimagesize($path12);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path12, $weight1, $height1, "0","big/".$path12);
if($path12 !='upfiles/'.$data."-6"){unlink($path12);}
if($oldimages6!=""){unlink($oldimages6);unlink("pic/".$oldimages6);unlink("big/".$oldimages6);}//删除旧图片
}
else
{
$path12=$oldimages6;
}
 
if($type13==".jpg"  or $type13==".jpge" or $type13==".gif" or $type13==".doc" or $type13==".xls" or $type13==".bmp" or $type13==".pdf" ){
move_uploaded_file($_FILES['images7']['tmp_name'],$path14);//上传图片
$resizeimage = new resizeimage($path14, "200", "100", "0","pic/".$path14);
if($path14 !='upfiles/'.$data."-7"){unlink($path14);}
if($oldimages7!=""){unlink($oldimages7);unlink("pic/".$oldimages7);}//删除旧图片
}
else
{
$path14=$oldimages7;
}

if($type15==".jpg"  or $type15==".jpge" or $type15==".gif" or $type15==".doc" or $type15==".xls" or $type15==".bmp" or $type15==".pdf" ){
move_uploaded_file($_FILES['images8']['tmp_name'],$path16);//上传图片
$resizeimage = new resizeimage($path16, "200", "100", "0","pic/".$path16);
if($oldimages8!=""){unlink($oldimages8);unlink("pic/".$oldimages8);}//删除旧图片
}
else
{
$path16=$oldimages8;
}





if($query=mysql_query("update ".$webname." set c1='$c1',c2='$c2',c3='$c3',c4='$c4',c5='$c5',c6='$c6',c7='$c7',c8='$c8',c9='$c9',title='$title',entitle='$entitle',BigClassName='$BigClassName',BigClassName2='$BigClassName2',BigClassName3='$BigClassName3',BigClassName4='$BigClassName4',BigClassName5='$BigClassName5',lb='$lb',enBigClassName='$enBigClassName',SmallClassName='$SmallClassName',enSmallClassName='$enSmallClassName',content='$content',encontent='$encontent',edittime='$addtime',editname='$editname',images='$path2',images2='$path4',images3='$path6',images4='$path8',images5='$path10',images6='$path12',images7='$path14',images8='$path16' where id='$id'"))

{
   echo "<script>alert('資料修改成功！');window.location.href='".$linkname.".php?page=".$page."';</script>";
 }
 
 else
  {
   echo "<script>alert('資料修改失敗！');window.location.href='".$linkname.".php?page=".$page."';</script>";
  }
}
?>
 
 
 
 
 
<?PHP
 	$id=make_safe($_GET["id"]);	 
    $sql="select * from tagcloud where id='$id' order by id desc";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
?>
 <div id="contact-add">
 
 <form method="post" enctype="multipart/form-data" name="form1" onSubmit="return CheckForm();" action="?action=xiugai&id=<?php echo $row->id;?>" target="_self">
   <table border="0" cellpadding="0" cellspacing="0" >
     <tr>
       <td>標簽內容：
         <label for="textfield2"></label>
         <input name="title" type="text" class="contact_add-tit-keyin"  value="<?php echo $row->title;?>" /></td>
     </tr>
     
     
     
   </table>
   
 

 
 <table border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td>      <input type="submit" name="Submit" value="提交修改" /></td>
  </tr>
</table>
</form>


 </div>
 <?php }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 <!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
 <?php include_once('blog_botton_btn.php');?>
</div>
</body>
</html>
